from config import config
import time
import httplib
import math
import datetime

days = 8
m = 2000
increment = math.pi / (60 * 24)
now = datetime.datetime.now()
for day in xrange(1, 8):
  start = now - datetime.timedelta(days = day)
  for minute in xrange(0, 24 * 60):
    t = start + datetime.timedelta(minutes = minute)
    watts = int(m * math.sin(float(minute) * increment))
    print "%s:%d" % (t, watts)
    conn = httplib.HTTPConnection('localhost:8080')
    conn.request("GET", "/submit?system=%s&date=%d&watts=%d&kwhToday=%f&kwhLifetime=%f"
                 % (config['system'], time.mktime(t.utctimetuple()), watts, 0, 0))

